<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../inc_jqgrid.jsp"></jsp:include>
    <title>修改旅客信息</title>

    <script type="text/javascript">
        $(function(){
            //加载旅客信息
            $("#jqGrid").jqGrid({
                url:'${ctx}/order/queryPassenger/${orderNumber}?temp='+Math.random(),
                mtype: "GET",
                datatype: "json",
                shrinkToFit: true,//按比例初始化列宽度
                viewrecords: true,//是否要显示总记录数
                rownumbers: true,//显示行顺序号
                rownumWidth: 35,//顺序号宽度
                multiselect: true,//定义是否可以多选
                multiboxonly: true,//为ture时只有选择checkbox才会起作用
                height : '90%', //"100%"
                rowNum: 20,//每页行数
                rowList : [ 10, 20, 55 ],//调整表格显示的记录数
                autowidth: true,
                caption: "乘客信息列表",//标题
                colModel: [
                    { label: 'Id', name: 'id', key: true, width: 75 },
                    { label: '票号', name: 'ticketNumber',  width: 100,hidden:true },
                    { label: '', name: 'lastName_en', width: 75,hidden:true },
                    { label: '', name: 'firstName_en', width: 75,hidden:true },
                    { label: '', name: 'lastName_cn', width: 75,hidden:true },
                    { label: '', name: 'firstName_cn',  width: 75,hidden:true },
                    { label: '', name: 'sex', width: 75,hidden:true },
                    { label: '', name: 'passageType',  width: 75,hidden:true },
                    { label: '', name: 'docType',  width: 75,hidden:true },
                    { label: '旅客姓名', name: 'Customer1', width: 70,
                        formatter : function(value,ops,row){
                            var lastNameEn=row.lastName_en;
                            var firstNameEn=row.firstName_en;
                            return "<span>"+lastNameEn+"</span>"+"<span>"+firstNameEn+"</span>"
                        } },
                    { label: '中文姓名', name: 'Customer2', width: 70,
                        formatter : function(value,ops,row){
                            var lastNamecn=row.lastName_cn;
                            var firstNamecn=row.firstName_cn;
                            return "<span>"+lastNamecn+"</span>"+"<span>"+firstNamecn+"</span>"
                        }},
                    { label: '性别', name: 'sex1', width: 40,
                        formatter : function(value,ops,row){
                            if(row.sex ==2){
                                return "女";
                            }else if(row.sex==1){
                                return "男";
                            };
                        }},
                    { label:'旅客类型', name: 'passageType1', width: 70,
                        formatter : function(value,ops,row){
                            if(row.passageType ==0){
                                return "婴儿";
                            }else if(row.passageType==1){
                                return "成人";
                            }else if(row.passageType == 2){
                                return "儿童";
                            };
                        }},
                    { label:'证件类别', name: 'docType1', width: 70,
                        formatter : function(value,ops,row){
                            if(row.docType==1){
                                return "身份证 ";
                            }else if(row.docType == 2){
                                return "护照";
                            };
                        }},
                    { label:'证件号', name: 'docId', width: 100 },
                    { label:'证件有效期', name: 'docExpireDate', width: 80 },
                    { label:'出生日期', name: 'birthDate', width: 80 },
                    { label:'手机号', name: 'mobile', width: 100 },
                    { label:'国籍', name: 'nationality', width: 80 },
                    { label:'签发国家', name: 'issueCountry', width: 80 },
                    { label:'酒店', name: 'grogshop', width: 100 },
                    { label:'联运', name: 'throughTraffic', width: 100 },
                    { label:'备注', name: 'remark', width: 100 },
                    { label:'操作', name: 'act', width: 70,
                        formatter : function(value,ops, row) {
                            var str = '<a href="javascript:void(0)" onclick="editFun(\''+row.id+'\');" >修改</a>';
                            return str;
                        }}
                ]
            });
        });
        function editFun(id){
            layer.open({
                type: 2,
                title: ['修改乘客信息','background-color:#00B2EE; color:#fff;'],
                shadeClose: false,
                shade: 0.3,
                closeBtn: 1, //显示关闭按钮
                yes: function(index, layero) {
                    layer.close(index);
                },
                area: ['600px', '550px'],
                content: ['${ctx}/order/toPassengerEdit/'+id, 'no'], //iframe的url，no代表不显示滚动条
                end:function(){
                    $("#jqGrid").trigger("reloadGrid");
                }
            });
        };
    </script>
</head>
<body>
<jsp:include page="../head.jsp"></jsp:include>
<div class="divBox" style="margin-top: 10px">
            <table id="jqGrid"></table>
</div>
<jsp:include page="../footer.jsp"></jsp:include>
</body>
</html>